<template>
  <div class="">
    书名： <input type="text" v-model="title" /> 价格：<input
      type="text"
      v-model="price"
    />
    <button @click="add">添加</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      title: "",
      price: "",
    };
  },
  mounted() {},
  methods: {
    add() {
      this.$emit("add", this.title, this.price);
      this.title = "";
      this.price = "";
    },
    //调用父组件传过来的 添加方法
  },
  components: {},
};
</script>

<style lang="scss"></style>
